.class Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;
.super Ljava/lang/Object;

# interfaces
.implements Lcom/kwad/sdk/api/loader/ProducerFactory$Producer;


# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/kwad/sdk/api/loader/ProducerFactory;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0xa
    name = "InstallProducer"
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Ljava/lang/Object;",
        "Lcom/kwad/sdk/api/loader/ProducerFactory$Producer<",
        "Ljava/lang/Boolean;",
        ">;"
    }
.end annotation


# instance fields
.field mContext:Landroid/content/Context;

.field mInputProducer:Lcom/kwad/sdk/api/loader/ProducerFactory$Producer;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Lcom/kwad/sdk/api/loader/ProducerFactory$Producer<",
            "Lcom/kwad/sdk/api/loader/Api$Data;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method constructor <init>(Lcom/kwad/sdk/api/loader/ProducerFactory$Producer;Landroid/content/Context;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/kwad/sdk/api/loader/ProducerFactory$Producer<",
            "Lcom/kwad/sdk/api/loader/Api$Data;",
            ">;",
            "Landroid/content/Context;",
            ")V"
        }
    .end annotation

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-object p1, p0, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;->mInputProducer:Lcom/kwad/sdk/api/loader/ProducerFactory$Producer;

    iput-object p2, p0, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;->mContext:Landroid/content/Context;

    return-void
.end method

.method static synthetic access$000(Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;Landroid/content/Context;)Z
    .locals 0

    invoke-direct {p0, p1}, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;->isMainProcess(Landroid/content/Context;)Z

    move-result p0

    return p0
.end method

.method private getCurrentProcessName(Landroid/content/Context;)Ljava/lang/String;
    .locals 4
    .param p1    # Landroid/content/Context;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    invoke-static {}, Landroid/os/Process;->myPid()I

    move-result v0

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object p1

    const-string v1, "activity"

    invoke-virtual {p1, v1}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Landroid/app/ActivityManager;

    invoke-virtual {p1}, Landroid/app/ActivityManager;->getRunningAppProcesses()Ljava/util/List;

    move-result-object p1

    invoke-interface {p1}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object p1

    const-string v1, ""

    :cond_0
    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result v2

    if-eqz v2, :cond_1

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Landroid/app/ActivityManager$RunningAppProcessInfo;

    iget v3, v2, Landroid/app/ActivityManager$RunningAppProcessInfo;->pid:I

    if-ne v3, v0, :cond_0

    iget-object v1, v2, Landroid/app/ActivityManager$RunningAppProcessInfo;->processName:Ljava/lang/String;

    goto :goto_0

    :cond_1
    return-object v1
.end method

.method private isMainProcess(Landroid/content/Context;)Z
    .locals 1
    .param p1    # Landroid/content/Context;
        .annotation build Landroidx/annotation/NonNull;
        .end annotation
    .end param

    invoke-virtual {p1}, Landroid/content/Context;->getApplicationContext()Landroid/content/Context;

    move-result-object v0

    invoke-virtual {v0}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v0

    invoke-direct {p0, p1}, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;->getCurrentProcessName(Landroid/content/Context;)Ljava/lang/String;

    move-result-object p1

    invoke-virtual {v0, p1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result p1

    return p1
.end method


# virtual methods
.method public produceResults(Lcom/kwad/sdk/api/loader/ProducerFactory$Consumer;)V
    .locals 2
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Lcom/kwad/sdk/api/loader/ProducerFactory$Consumer<",
            "Ljava/lang/Boolean;",
            ">;)V"
        }
    .end annotation

    iget-object v0, p0, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;->mInputProducer:Lcom/kwad/sdk/api/loader/ProducerFactory$Producer;

    new-instance v1, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer$1;

    invoke-direct {v1, p0, p1}, Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer$1;-><init>(Lcom/kwad/sdk/api/loader/ProducerFactory$InstallProducer;Lcom/kwad/sdk/api/loader/ProducerFactory$Consumer;)V

    invoke-interface {v0, v1}, Lcom/kwad/sdk/api/loader/ProducerFactory$Producer;->produceResults(Lcom/kwad/sdk/api/loader/ProducerFactory$Consumer;)V

    return-void
.end method
